package com.mtao.bean;

import lombok.Data;

@Data
public class RestBean<T> {
    private int status;
    private boolean success;
    private String msg;
    private T data;

    public RestBean(int status, boolean success, String msg,T data) {
        this.status = status;
        this.success = success;
        this.msg = msg;
        this.data=data;
    }

    public static <T> RestBean<T> success() {
        return new RestBean<>(200, true,null,null);
    }
    public static <T> RestBean<T> success(String msg) {
        return new RestBean<>(200, true, msg,null);
    }
    public static <T> RestBean<T> success(String msg,T data) {
        return new RestBean<>(200, true,msg, data);
    }
    public static <T> RestBean<T> failure(int status,String msg) {
        return new RestBean<>(200, true, msg,null);
    }

    public static <T> RestBean<T> failure(int status, String msg,T data) {
        return new RestBean<>(status, true,msg, data);
    }
}
